import React, { useState } from 'react'
import MyContext from './MyContext'
import ContextB from './ContextB'

export default function ContextA() {
  const [num, setNum] = useState(0)
  return (
    <div style={{ padding: '30px' }}>
      <div>ContextA</div>
      {/* 上下文的提供者组件 */}
      <MyContext.Provider value={{ num, setNum }}>
        {/* <MyContext.Provider value={{ num: 5, setNum }}> */}
          <ContextB></ContextB>
        {/* </MyContext.Provider> */}
      </MyContext.Provider>
    </div>
  )
}